package handler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.ResultSetHandler;

import drh.bean.Users;

public class UsersResultSetHandler implements ResultSetHandler<List<Users>> {
	
	@Override
	public List<Users> handle(ResultSet rs) throws SQLException {
		List<Users>list = new ArrayList<>();
		while(rs.next()) {
		Users info = new Users();
		info.setUserid(rs.getInt("userId"));
		info.setLogintype(rs.getInt("logintype"));
		info.setUsername(rs.getString("username"));
		info.setTel(rs.getString("tel"));
		info.setPwd(rs.getString("pwd"));
		info.setEmail(rs.getString("email"));
		info.setRealname(rs.getString("realname"));
		info.setTime(rs.getDate("time"));
		info.setIsdelete(rs.getInt("isdelete"));
	    list.add(info);
		}
		return list;
	}

}
